/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.ideastec.mipyme.persistence.fax;

import java.util.List;

import com.ideastec.mipyme.model.fax.Fax;
import com.ideastec.mipyme.persistence.DAOPadre;
import com.ideastec.mipyme.repository.fax.RepositorioFax;

/**
 *
 * @author Diego Rafael Graf
 */

public class DAOFax extends DAOPadre<Fax> implements RepositorioFax{
    
    @Override 
    protected Class<Fax> getClase(){
        return Fax.class;
    }
    
    @Override
    public List<Fax> buscarTodos() throws Exception{
        try{
            return this.getHibernateTemplate().find("from " + persistentClass.getName() + " order by fax asc");
        }
        catch(Exception e){
            throw new Exception(e);
        }
    }    
    
    @Override
    public List<Fax> buscarFax(Fax fax) throws Exception{
        try{
            return this.getHibernateTemplate().find("from " + persistentClass.getName() + " where fax = '" + fax.getFax() + "'");
        }
        catch(Exception e){
            throw new Exception(e);
        }
    }
    
}
